package Data::Semantic::Net::IPAddress::IPv6;

use strict;
use warnings;
use Net::IP qw/ip_is_ipv6 ip_iptype/;


our $VERSION = '0.01';


use base qw(Data::Semantic::Net::IPAddress);


sub is_valid_normalized_value {
    my ($self, $value) = @_;
    $self->SUPER::is_valid_normalized_value($value) && ip_is_ipv6($value);
}

    
sub is_internal {
    my ($self, $value) = @_;
    return unless defined $value;
    (ip_iptype($value, 6) || '') eq 'GLOBAL-UNICAST';
}   


1;


__END__

{% USE p = PodGenerated %}

=head1 NAME

{% p.package %} - semantic data class for IPv6 addresses

=head1 SYNOPSIS

    my $obj = {% p.package %}->new;
    if ($obj->is_valid($value)) { ... }

=head1 DESCRIPTION

This class can tell whether a value is an IPv6 address. The C<valid()> methd
will respect the inherited C<forbid_internal> boolean attribute.

{% p.write_inheritance %}

=head1 METHODS

=over 4

{% p.write_methods %}

=item is_internal

Takes a value and returns true if the indicated IPv4 address is an internal
address.

=back

{% PROCESS standard_pod %}

=cut

